package com.example.orderservice.dto;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 订单请求DTO
 */
public class OrderRequest {
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    @Valid // 验证嵌套对象
    private List<OrderItemRequest> items; // 现在引用的是独立类

    // Getter和Setter保持不变
    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public List<OrderItemRequest> getItems() {
        return items;
    }

    public void setItems(List<OrderItemRequest> items) {
        this.items = items;
    }
}